{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "59f46d6b-bbb2-4233-8a88-f6d349640389",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(1, 10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e81831da-e8f0-43b8-91cf-d273e7d06ab1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "L = []\n",
    "for x in range (1, 11):\n",
    "    L.append(x *x )\n",
    "\n",
    "L "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6138bcad-ec0c-4f60-aa3c-74bfa8438326",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[x *x for x in range(1, 11)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d0187fd0-2ad9-4607-8e4c-7ef11a000125",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[4, 16, 36, 64, 100]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[x* x for x in range(1, 11) if x %2 == 0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "51b03e4f-97e3-4ca3-a0d3-18548d8e9498",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['AX', 'AY', 'AZ', 'BX', 'BY', 'BZ', 'CX', 'CY', 'CZ']"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[m + n for m in 'ABC' for n in 'XYZ']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "107b607c-eb68-4660-bc9b-6ee00f70596a",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (3510381040.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[7], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    [x for x in range(1, 11) if x %2 ==0 else 0]\u001b[0m\n\u001b[1;37m                                         ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "[x for x in range(1, 11) if x %2 ==0 else 0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b66d681b-2c7e-4921-94f2-cce5d4866d6b",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (1605201549.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[8], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    [x if x %2 ==0  for x in range(1, 11) ]\u001b[0m\n\u001b[1;37m                    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "[x if x %2 ==0  for x in range(1, 11) ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f77c8c0c-bd63-4576-b6e6-b3511d540768",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[x if x %2 ==0 else -x  for x in range(1, 11) ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "e4461983-97f3-492e-ae00-c355dadf0cee",
   "metadata": {},
   "outputs": [],
   "source": [
    "def lowers(lists):\n",
    "    temp = []\n",
    "    for x in lists:\n",
    "        if isinstance(x, str):\n",
    "            temp.append(x.lower())\n",
    "    return temp\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "953b7554-223d-40e1-b2e0-b716aa3bf267",
   "metadata": {},
   "outputs": [],
   "source": [
    "L = ['Hello', 'World', 18, 'Apple', None]\n",
    "L2 = [] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "7fbec59b-3cd8-44ff-85b0-67f5dd38f0b0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['hello', 'world', 'apple']"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "L2 = lowers(L)\n",
    "L2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "c75658a7-32d6-4f07-95f1-9fe580a2c255",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['hello', 'world', 'apple']"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "L2 = [ x.lower()  for x in L   if isinstance(x, str)]\n",
    "L2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eb6c50b1-1414-41d4-9615-94cb0aa0e1d6",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
